<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../core/include.inc.jsp"%>

<style>
    .pageFormContent p {
        width: 90%;
    }
</style>

<div class="pageContent">
    <form method="post" action="module_add" class="pageForm required-validate"
          onsubmit="return validateCallback(this, dialogAjaxDone)">

        <div class="pageFormContent nowrap" layoutH="57">
            <p>
                <label>顶级模块</label>
                <select name="parentId" class="combox">
                    <option value="0">无</option>
                    <c:forEach items="${list}" var="parent">
                        <option value="${parent.id}">${parent.name}</option>
                    </c:forEach>
                </select>
            </p>

            <p>
                <label>模块名称</label>
                <input type="text" name="name" class="required" maxlength="20" />
            </p>

            <p>
                <label>地址</label>
                <input type="text" name="url" class="" maxlength="20" />
            </p>

            <p>
                <label>状态</label>
                <select class="combox" name="status">
                    <option value="1">上线</option>
                    <option value="2">下线</option>
                </select>
            </p>

            <table width="100%">
                <tr class="text-normal">
                    <td>
                        <label>logo</label>
                        <div class="image-logo">
                            <img src="${app:getLocalUrl() }/assets/ext/js/uploadify/add_img.png" class="imgList">
                            <input type="file" onchange="upload(0)" class="imgFile"/>
                        </div>
                    </td>
                </tr>
            </table>

            <input type="hidden" name="logo" class="logo" value="" />

        </div>
        <div class="formBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent" style="text-align: center;">
                            <button type="submit">保存</button>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </form>
</div>
<script>

    // 设置图片地址
    function setImage(index,url) {
        $('.imgList').eq(index).attr('src',url);
        $('.logo').eq(index).val(url);
    }

    function upload(index) {
        uploadImage(index,$('.imgFile').eq(index).get(0).files[0]);
    }

</script>